package Controller.Singer;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.catalina.Session;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;

import Dao.SingerDao;

public class singerBoardInsertformController implements Controller{
	private SingerDao dao;
	
	public void setDao(SingerDao dao) {
		this.dao = dao;
	}

	@Override
	public ModelAndView handleRequest(HttpServletRequest req,
			HttpServletResponse res) throws Exception {
		String s_no = req.getParameter("s_no");
		System.out.println("s_no값:"+s_no);
		HttpSession session = req.getSession();
		ModelAndView mav = new ModelAndView();
		String m_id = (String)session.getAttribute("member");
		System.out.println("로그인 한 아이디 : "+m_id);
		if(m_id == null){
			System.out.println("로그인을 하세요");
			/*mav.setViewName("redirect:/singerBoard.singer?singerNo="+s_no);*/
			mav.setViewName("InsertError");
			return mav;
		}
		else{
			System.out.println("작업시작");
			mav.setViewName("sboardInsertform");
			mav.addObject("s_no", s_no);
			mav.addObject("m_id", m_id);
			return mav;
		}
		

	}

}
